package change;

import page.WikiPage;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: Evgeniy Krasko
 * Date: 20.11.11
 * Time: 23:16
 */
public class Revision {
    private long revId;
    private WikiPage wikiPage;
    private Date date;

    public Revision(long revId, WikiPage wikiPage, Date date) {
        this.revId = revId;
        this.wikiPage = wikiPage;
        this.date = date;
    }

    public long getRevId() {
        return revId;
    }

    public WikiPage getWikiPage() {
        return wikiPage;
    }

    public Date getDate() {
        return date;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Revision revision = (Revision) o;

        return revId == revision.revId;

    }

    @Override
    public int hashCode() {
        return (int) (revId ^ (revId >>> 32));
    }

    @Override
    public String toString() {
        return "Revision " + revId + " " + date.toString() + " " + wikiPage.getTitle();
    }
}
